package com.my.mvpdemo.mvp1.view;
/**
 * M model 业务模型
 * V: view  视图层 activity /xml
 * P：presenter 表示层
 */

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.GridView;
import android.widget.ListView;
import android.widget.Toast;

import com.my.mvpdemo.Girl;
import com.my.mvpdemo.R;
import com.my.mvpdemo.mvp1.adapter.GirlAdapter;
import com.my.mvpdemo.mvp1.presenter.GirlPresenter;

import java.util.List;

public class GridGirlActivity extends AppCompatActivity implements IGirlView{

    private GridView gridView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gridview);
        gridView = (GridView) findViewById(R.id.gridView);
//        listView.setAdapter(new GirlAdapter(this,null));
        new GirlPresenter(this).fetch();
    }

    @Override
    public void showLoading() {
        Toast.makeText(this,"开始下载",Toast.LENGTH_SHORT).show();;
    }

    @Override
    public void showGirls(List<Girl> girls) {
        gridView.setAdapter(new GirlAdapter(this,girls));
    }
}
